package com.es.disped.dao.oj.mapper;

import com.es.disped.dao.oj.model.News;
import com.es.disped.dao.oj.model.NewsExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface NewsMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @SelectProvider(type=NewsSqlProvider.class, method="countByExample")
    long countByExample(NewsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @DeleteProvider(type=NewsSqlProvider.class, method="deleteByExample")
    int deleteByExample(NewsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Delete({
        "delete from news",
        "where news_id = #{newsId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer newsId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Insert({
        "insert into news (news_id, user_id, ",
        "title, time, importance, ",
        "defunct, content)",
        "values (#{newsId,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, ",
        "#{title,jdbcType=VARCHAR}, #{time,jdbcType=TIMESTAMP}, #{importance,jdbcType=TINYINT}, ",
        "#{defunct,jdbcType=CHAR}, #{content,jdbcType=LONGVARCHAR})"
    })
    int insert(News record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @InsertProvider(type=NewsSqlProvider.class, method="insertSelective")
    int insertSelective(News record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @SelectProvider(type=NewsSqlProvider.class, method="selectByExampleWithBLOBs")
    @Results({
        @Result(column="news_id", property="newsId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="time", property="time", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="importance", property="importance", jdbcType=JdbcType.TINYINT),
        @Result(column="defunct", property="defunct", jdbcType=JdbcType.CHAR),
        @Result(column="content", property="content", jdbcType=JdbcType.LONGVARCHAR)
    })
    List<News> selectByExampleWithBLOBs(NewsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @SelectProvider(type=NewsSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="news_id", property="newsId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="time", property="time", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="importance", property="importance", jdbcType=JdbcType.TINYINT),
        @Result(column="defunct", property="defunct", jdbcType=JdbcType.CHAR)
    })
    List<News> selectByExample(NewsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Select({
        "select",
        "news_id, user_id, title, time, importance, defunct, content",
        "from news",
        "where news_id = #{newsId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="news_id", property="newsId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="time", property="time", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="importance", property="importance", jdbcType=JdbcType.TINYINT),
        @Result(column="defunct", property="defunct", jdbcType=JdbcType.CHAR),
        @Result(column="content", property="content", jdbcType=JdbcType.LONGVARCHAR)
    })
    News selectByPrimaryKey(Integer newsId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @UpdateProvider(type=NewsSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") News record, @Param("example") NewsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @UpdateProvider(type=NewsSqlProvider.class, method="updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") News record, @Param("example") NewsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @UpdateProvider(type=NewsSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") News record, @Param("example") NewsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @UpdateProvider(type=NewsSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(News record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Update({
        "update news",
        "set user_id = #{userId,jdbcType=VARCHAR},",
          "title = #{title,jdbcType=VARCHAR},",
          "time = #{time,jdbcType=TIMESTAMP},",
          "importance = #{importance,jdbcType=TINYINT},",
          "defunct = #{defunct,jdbcType=CHAR},",
          "content = #{content,jdbcType=LONGVARCHAR}",
        "where news_id = #{newsId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKeyWithBLOBs(News record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table news
     *
     * @mbg.generated Mon Jun 10 19:18:24 CST 2019
     */
    @Update({
        "update news",
        "set user_id = #{userId,jdbcType=VARCHAR},",
          "title = #{title,jdbcType=VARCHAR},",
          "time = #{time,jdbcType=TIMESTAMP},",
          "importance = #{importance,jdbcType=TINYINT},",
          "defunct = #{defunct,jdbcType=CHAR}",
        "where news_id = #{newsId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(News record);
}